Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle gracefully empty arch in kube env. #4973

Merged
merged 1 commit into from
Jun 15, 2022

Conversation

olagacek
Copy link
Contributor

Which component this PR applies to?

cluster-autoscaler

What type of PR is this?

/kind bug

What this PR does / why we need it:

It prevents error in cluster-autoscaler in case empty arch is provided in kube env.

@k8s-ci-robot k8s-ci-robot added kind/bug Categorizes issue or PR as related to a bug. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Jun 15, 2022
@x13n
Copy link
Member

x13n commented Jun 15, 2022

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jun 15, 2022
@@ -598,6 +598,8 @@ func ToSystemArchitecture(arch string) SystemArchitecture {
return Arm64
case string(Amd64):
return Amd64
case "":
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we just change default: to return DefaultArch? It seems surprising to differentiate.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then we would return DefaultArch for arch == "funny cat" - I'm not sure if this is okay.

We can expect empty string to just be an alias for default, I don't think the same can be said for other values.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I decided to go with using DefaultArch as default:, given that incorrect value in this place will lead to cluster autoscaler crash in main loop.

@MaciekPytel
Copy link
Contributor

/approve
/hold
Approve, because the fix seems clearly like the right thing to fix. Hold to give you a chance to reply to my comment.
Please feel free to cancel hold without my explicit lgtm.

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jun 15, 2022
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: MaciekPytel, olagacek

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jun 15, 2022
@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jun 15, 2022
@MaciekPytel
Copy link
Contributor

/lgtm
/hold cancel

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jun 15, 2022
@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jun 15, 2022
@k8s-ci-robot k8s-ci-robot merged commit 9a76079 into kubernetes:master Jun 15, 2022
towca added a commit to towca/autoscaler that referenced this pull request Jun 21, 2022
…hitectures

PR kubernetes#4973 changed ToSystemArchitecture behavior to return DefaultArch
instead of UnknownArch for invalid architectures. This kind of defaulting
makes sense while parsing KUBE_ENV, but prevents using the function
in contexts where an invalid architecture should result in an error.

This commit reverts ToSystemArchitecture to previous behavior, and
moves defaulting to the callsite.
navinjoy pushed a commit to navinjoy/autoscaler that referenced this pull request Oct 26, 2022
Handle gracefully empty arch in kube env.
navinjoy pushed a commit to navinjoy/autoscaler that referenced this pull request Oct 26, 2022
…hitectures

PR kubernetes#4973 changed ToSystemArchitecture behavior to return DefaultArch
instead of UnknownArch for invalid architectures. This kind of defaulting
makes sense while parsing KUBE_ENV, but prevents using the function
in contexts where an invalid architecture should result in an error.

This commit reverts ToSystemArchitecture to previous behavior, and
moves defaulting to the callsite.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/bug Categorizes issue or PR as related to a bug. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants